package project.movieMap.baseLib.beans;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import lombok.*;

import java.util.HashSet;

@Data
@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY, property = "@class")
@JsonIgnoreProperties(ignoreUnknown = true)
public class GeoInfo {
    //实例化GeoInfo必须有经纬度
    @JsonCreator
    public GeoInfo(@JsonProperty("longitude") double longitude, @JsonProperty("dimension") double dimension) {
        this.longitude = longitude;
        this.dimension = dimension;
    }

    //地理信息Id
    private int Id;
    //经度
    private double longitude;
    //维度
    private double dimension;
    //地区
    private String region;
    //地区详细信息
    private String regionDetail;
    //地图电影信息描述
    private String regionMovieDetail;
    //地图评分
    private float rating;
    //相关电影信息
    private HashSet<Integer> movieIds = new HashSet<>();
    //相关对地理位置的评论信息
    private HashSet<Integer> commentIds = new HashSet<>();

    public void addMovieId(int id) {
        movieIds.add(id);
    }
    public void removeMovieId(int id) {
            movieIds.remove(id);
    }
    public void addCommentId(int id) {
        commentIds.add(id);
    }
    public void removeCommentId(int id) {
            commentIds.remove(id);
    }
}
